let a;

a = 10;
a = 'hello';

//指定一个类型就好了
let b: number;
let c: string;
let d: boolean = true;

// TS2322: Type '"hello"' is not assignable to type 'number'.
// b = 'hello';//不允许
b = 10;//允许
c = 'love';

//主动类型推断
let e = false;
e = true;

//约束形参 与 返回值
function sum(a: number, b: number): number {

    return a + b;
}

console.log(sum(100, 100));
